from django import forms
from .models import SparkCard


# 好似有无数次彷徨
class CardForms(forms.ModelForm):

    title = forms.CharField(
        label='标题',
        min_length=1,
        max_length=15,
        widget=forms.TextInput(attrs={'class': 'form-control'})
    )

    context = forms.CharField(
        label='灵感内容',
        min_length=2,
        max_length=120,
        widget=forms.TextInput(attrs={'class': 'form-control'}),
    )

    class Meta:
        model = SparkCard
        fields = ('title', 'spark_content')
        error_messages = {
            'min_length':'太短啦！',
            'max_length':'太长啦！',
        }

